$.zhh.events.on("/demo/easyui/payment/", function(space, initial, extras) {

	var v = {};

	v.onPaySubmit = function(e) {
		var btn = $(this);
		createOrderForm.call(this, e, function(orderId) {
			var payChannel = btn.xcall("options").payChannel;
			var returnUrl = Utils.getBaseUrl("test/#/demo/easyui/payment/");
			var data = { orderType:"TEST", orderId:orderId, returnUrl:returnUrl };
			btn.payment(payChannel, "PC", data);
		});
	};

	var orderId = null;
	var createOrderForm = function(e, callback) {
		// 1.提交商品信息和购买数量
		// 2.后台生成订单并返回订单编号
		if (!orderId) { orderId = Dates.format(new Date(), "yyyyMMddHHmmssSSS"); }
		callback(orderId);
	};
	
	space.xui(v);
});
